package Smallprogram.serlet;

import Smallprogram.entiy.Orderbiao;
import Smallprogram.servict.impl.OrderbiaoServictImpl;
import com.alibaba.fastjson.JSON;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

@WebServlet(name = "OrderbiaoidServlet", value = "/OrderbiaoidServlet")
public class OrderbiaoidServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        ServletContext context = getServletContext();
        String id = (String) context.getAttribute("id");
        int ididen=id!=null?Integer.parseInt(id):0;
        System.out.println(ididen);
        OrderbiaoServictImpl Ord=new OrderbiaoServictImpl();
        List<Orderbiao> list=Ord.selectorderbiaoid(1);
        String listnem= JSON.toJSONString(list);
        PrintWriter out= response.getWriter();
        if (list!=null){
            out.print(listnem);
        }

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
